home *** CD-ROM | disk | FTP | other *** search
- package java.io;
-
- public class BufferedWriter extends Writer {
- private Writer out;
- // $FF: renamed from: cb char[]
- private char[] field_0;
- private int nChars;
- private int nextChar;
- private static int defaultCharBufferSize = 8192;
- private String lineSeparator;
-
- public BufferedWriter(Writer var1) {
- this(var1, defaultCharBufferSize);
- }
-
- public BufferedWriter(Writer var1, int var2) {
- super(var1);
- if (var2 <= 0) {
- throw new IllegalArgumentException("Buffer size <= 0");
- } else {
- this.out = var1;
- this.field_0 = new char[var2];
- this.nChars = var2;
- this.nextChar = 0;
- SecurityManager.enablePrivilege("UniversalPropertyRead");
- this.lineSeparator = System.getProperty("line.separator");
- SecurityManager.revertPrivilege();
- }
- }
-
- private void ensureOpen() throws IOException {
- if (this.out == null) {
- throw new IOException("Stream closed");
- }
- }
-
- void flushBuffer() throws IOException {
- Object var1 = super.lock;
- synchronized(var1){}
-
- try {
- this.ensureOpen();
- if (this.nextChar != 0) {
- this.out.write(this.field_0, 0, this.nextChar);
- this.nextChar = 0;
- return;
- }
- } catch (Throwable var4) {
- throw var4;
- }
-
- }
-
- public void write(int var1) throws IOException {
- Object var2 = super.lock;
- synchronized(var2){}
-
- try {
- this.ensureOpen();
- if (this.nextChar >= this.nChars) {
- this.flushBuffer();
- }
-
- this.field_0[this.nextChar++] = (char)var1;
- } catch (Throwable var4) {
- throw var4;
- }
-
- }
-
- public void write(char[] var1, int var2, int var3) throws IOException {
- Object var4 = super.lock;
- synchronized(var4){}
-
- try {
- this.ensureOpen();
- if (var3 < this.nChars) {
- int var6 = var2;
- int var7 = var2 + var3;
-
- while(var6 < var7) {
- int var8 = Math.min(this.nChars - this.nextChar, var7 - var6);
- System.arraycopy(var1, var6, this.field_0, this.nextChar, var8);
- var6 += var8;
- this.nextChar += var8;
- if (this.nextChar >= this.nChars) {
- this.flushBuffer();
- }
- }
-
- return;
- }
-
- this.flushBuffer();
- this.out.write(var1, var2, var3);
- } catch (Throwable var10) {
- throw var10;
- }
-
- }
-
- public void write(String var1, int var2, int var3) throws IOException {
- Object var4 = super.lock;
- synchronized(var4){}
-
- try {
- this.ensureOpen();
- int var6 = var2;
- int var7 = var2 + var3;
-
- while(var6 < var7) {
- int var8 = Math.min(this.nChars - this.nextChar, var7 - var6);
- var1.getChars(var6, var6 + var8, this.field_0, this.nextChar);
- var6 += var8;
- this.nextChar += var8;
- if (this.nextChar >= this.nChars) {
- this.flushBuffer();
- }
- }
- } catch (Throwable var10) {
- throw var10;
- }
-
- }
-
- public void newLine() throws IOException {
- ((Writer)this).write(this.lineSeparator);
- }
-
- public void flush() throws IOException {
- Object var1 = super.lock;
- synchronized(var1){}
-
- try {
- this.flushBuffer();
- this.out.flush();
- } catch (Throwable var3) {
- throw var3;
- }
-
- }
-
- public void close() throws IOException {
- Object var1 = super.lock;
- synchronized(var1){}
-
- try {
- if (this.out != null) {
- this.flushBuffer();
- this.out.close();
- this.out = null;
- this.field_0 = null;
- return;
- }
- } catch (Throwable var4) {
- throw var4;
- }
-
- }
- }
-